<template>
	<view class="disPosal">
		<view class="dis-title flex">
			<view class="title">{{eventData.eventTypeLv2Name}}</view>
			<view class="inforBtn" @click="todetail">详情</view>
		</view>
		<view class="dis-cont mb30">
			<view class="f18">问题描述：</view>
			<view class="color_7b">{{eventData.eventDescribe}}</view>
		</view>
		<view class="dis-cont mb50">
			<view class="f18">问题图片：</view>
			<view class="flex setImage" v-if="afterImagedata.imgs.length!=0">
				<image :src="image_url+item.path" mode="" v-for="(item,index) in afterImagedata.imgs" :key="index" @click="seeImages(index,afterImagedata)"></image>
			</view>
			<!-- <view class="flex setImage" else>暂无图片</view> -->
		</view>
		<view class="dis-cont mb30">
			<view class="f18">处置要求：</view>
			<view class="color_7b">{{eventData.endsConditions}}</view>
		</view>
		<view class="dis-cont mb50">
			<view class="f18">处置描述：</view>
			<view class="color_7b">{{beforImagedata.remark}}</view>
		</view>
		<view class="dis-cont mb30">
			<view class="f18">处置后图片：</view>
			<view class="flex setImage" v-if="beforImagedata.imgs.length>0">
				<image :src="image_url+item.path" mode="" v-for="(item,index) in beforImagedata.imgs" :key="index"  @click="seeImages(index,beforImagedata)"></image>
			</view>
			<!-- <view class="flex setImage" else>暂无图片</view> -->
		</view>
		<!-- <view class="trauch-up"></view> -->
		<view class="postBtn">
			<view class="btn" @click="resultBtn">核查</view>
		</view>
	</view>
</template>

<script>
	import {getEventresult} from '../../util/api.js'
	import URL from '../../util/url.js'
	export default {
		data() {
			return {
				eventItem:'',
				eventData:'',
				beforImagedata:{'imgs':[]},
				afterImagedata:{'imgs':[]},
				imageDate1:[],
				imageDate2:[],
				image_url: URL.IMAGEURL1,
			}
		},
		onLoad(e) {
			this.eventItem = e.eventItem? JSON.parse(e.eventItem): {};
			this.getResult()
		},
		methods: {
			getResult(){
				uni.showLoading()
				getEventresult({},this.eventItem.eventId).then((res)=>{
					console.log(res)
					uni.hideLoading()
					if(res.code == 200){
						this.eventData = res.data;
						var Images = JSON.parse(res.data.lglist.value)
						console.log(Images)
						if(Images.length>0){
							Images.forEach((item)=>{
								if(item.type_code == "0003" ||item.type_code == "0000"){
									this.afterImagedata = item
								}else  if(item.type_code == "0006"){
									this.beforImagedata = item
								}
							})
						}
					}else{
						this.$toast.showToast(res.msg)
					}
				}).catch((err)=>{
					console.log(err)
				})
			},
			todetail(){
				uni.navigateTo({
					url:'../detailPage/detailPage?eventItem='+ this.eventItem.eventId+'&pageType=1',
				})
			},
			seeImages(index, bigImgData) {
				var images = [];
				if(bigImgData.imgs.length>0){
					bigImgData.imgs.forEach((item)=>{
						images.push(this.image_url+item.path)
					})
				}
				uni.previewImage({
					urls: images,
					current: index,
				});
			},
			//9监理审核
			resultBtn(){
				var current_handing_type = 9;
				uni.removeStorageSync('currentLocation1');
				uni.navigateTo({
					url: '../detailPage/backCase?gdx='+this.eventItem.gdx+'&gdy='+this.eventItem.gdy+'&eventId='+this.eventItem.eventId + '&current_handing_type='+current_handing_type+'&eventItem='+JSON.stringify(this.eventItem)
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.disPosal{
	padding: 30rpx;
	height: 100vh;
	.dis-title{
		margin-bottom: 30rpx;
		.title{
			font-size: 36rpx;
			color: $qj-color;
		}
		.inforBtn{
			color: #FFFFFF;
			background-color: $qj-color;
			margin-left: 30rpx;
			padding: 4rpx 40rpx;
			border-radius: 40rpx;
		}
	}
	.dis-cont{
		.setImage{
			height: 156rpx;
			image{
				width: 160rpx;
				height: 100%;
				margin-right: 20rpx;
			}
		}
	}
	.postBtn{
		position: fixed;
		bottom: 50rpx;
		left: 0;
		right: 0;
		display: flex;
		justify-content: center;
		align-items: center;
		.btn{
			font-size: 32rpx;
			width: 280rpx;
			height: 74rpx;
			color: #FFFFFF;
			display: flex;
			justify-content: center;
			align-items: center;
			border-radius: 20rpx;
			background-color: $qj-color;
		}
	}
	.trauch-up{
		width: 0;
		height: 0;
		border-left: 10px solid blue;
		border-right: 10px solid blue;
		border-top: 10px solid yellow;
		border-bottom: 10px solid red;
	}
}
</style>
